package com.example.test.configuration;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.Page;

/**
 * Jackson配置
 */
@Configuration
public class JacksonObjectMapperConfiguration {
    public JacksonObjectMapperConfiguration(ObjectMapper objectMapper) {
        objectMapper.addMixIn(Page.class, ResponsePageMixin.class);
    }

    /**
     * 返回的Page对象的Mixin
     */
    @JsonIgnoreProperties({"pageable", "sort", "empty"})
    private interface ResponsePageMixin{}
}
